﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DotNetLib.Windows.Forms;

namespace DotNetLib.Sample.Windows
{
  public partial class ComboBoxSample : UserControl
  {
    public ComboBoxSample()
    {
      this.InitializeComponent();
    }

    private void autoSizeDropDownWidthButton_Click(object sender, EventArgs e)
    {
      this.comboBox1.AutoSizeDropDownWidth();
      this.comboBox2.AutoSizeDropDownWidth();
    }

    private void addLongerItemButton_Click(object sender, EventArgs e)
    {
      StringBuilder builder = new StringBuilder();
      builder.Append("This is a ");
      for (int index = 0; index < comboBox1.Items.Count; ++index)
      {
        builder.Append("really ");
      }
      builder.Append("long item");

      this.comboBox1.Items.Add(builder.ToString());
      this.comboBox2.Items.Add(builder.ToString());
    }
  }
}
